#include <stdio.h>
#include <stdlib.h>

#ifdef _WIN32
char readline(const char *prompt)
{
    static char buf[2048] = {0};
    fputs(prompt, stdout);
    fgets(buf, 0, stdin);
    char* cpy = malloc(strlen(buf)+1);
    strcpy(cpy, buf);
    cpy[strlen(cpy)-1] = '\0';
    return cpy;
}

void add_history(const char *cmd) {};

#else

#include <readline/readline.h>
#include <readline/history.h>

#endif

int main(int argc, char *argv[])
{
    puts("Lisp Version 0.0.1");
    puts("Press Ctrl+c to Exit\n");

    char *inputBuf = NULL;
    while(1) {
        inputBuf = readline("List> ");

        add_history(inputBuf);

        printf("No you are a %s\n", inputBuf);

        free(inputBuf);
        inputBuf = NULL;
    }

    return 0;
}
